<script type="text/javascript" language="javascript" charset="utf-8">
$(".menu-wrap li").removeClass("active-link");
$(".menu-wrap #student").addClass("active-link");
</script>
<div class="common-tit">
  <h2>学员详情</h2>
  <span><%= link_to "学员系统", admin_students_path %> &gt; 学员详情</span>
  <div class="cours-gbtn">
    <a href="<%= edit_admin_student_path(@student) %>">编辑</a>
  </div>
</div>
<div class="course-box">
  <h3>
    <span>基本信息</span>
  </h3>
  <div class="commo-dec clearfix">
    <div class="camera">
      <%= image_tag("#{@student.avatar_url}", size: "150x150", alt: "头像" ,id: "student_avatar_img")%>
    </div>
    <ul>
      <li>
        <span>姓名:</span>
        <em><%= @student.name %></em>
      </li>
      <li>
        <span>别名:</span>
        <em><%= @student.alias_name %></em>
      </li>
      <li>
        <span>性别:</span>
        <em><%= @student.sex %></em>
      </li>
      <li>
        <span>学员分组:</span>
        <em><%= @student.student_group_configuration.group_name if @student.student_group %></em>
      </li>
      <li>
        <span>手机号:</span>
        <em><%= @student.mobile %></em>
      </li>
      <li>
        <span>微信号:</span>
        <em><%= @student.weixin %></em>
      </li>
      <li>
        <span>出生年月:</span>
        <em><%= @student.birthday %></em>
      </li>
      <li>
        <span>信息来源:</span>
        <em><%= @student.source_from %></em>
      </li>
      <li>
        <span>紧急联系人:</span>
        <em><%= @student.emergency_contact %></em>
      </li>
      <li>
        <span>紧急联系电话:</span>
        <em><%= @student.emergency_mobile %></em>
      </li>
      <li class="sd-a">
        <span>联系地址:</span>
        <em><%= @student.address %></em>
      </li>
      <li class="sd-a">
        <span>备注信息:</span>
        <% if @student.remark %>
          <em><%= @student.remark %></em>
        <% else%>
        <em><%= @student.learning_requirement %> &nbsp; <%= @student.state_of_business %> &nbsp; <%= @student.learning_intention %></em>
        <% end %>
      </li>
    </ul>
  </div>
  <h3>
    <span>相关信息</span>
  </h3>
  <div class="course-b clearfix">
    <div class="st-dein clearfix">
      <div>
        <span>市场专员:</span>
        <em><%= @student.market_employee.name if @student.market_employee_id %></em>
      </div>
      <div>
        <span>服务顾问:</span>
        <em><%= @student.service_employee.name if @student.service_employee_id %></em>
      </div>
      <div>
        <span>意向导师:</span>
        <em><%= @student.willing_teacher %></em>
      </div>
      <!-- 前台权限控制 flydragon -->
      <% if !current_user.is_receptionist? %>
        <div>
          <span>消费能力:</span>
          <em><%= @student.shopping_level %></em>
        </div>
      <% end %>
    </div>
  </div>
  <h3>
    <span>消费信息</span>
  </h3>
  <div class="course-b s-consbox clearfix">
    <% @student.student_cards.each do |sc| %>
      <div class="stu-consumption clearfix">
        <div>
          <span>消费类型:</span>
          <em><%= sc.card_type %></em>
        </div>
        <div>
          <span>当前余额:</span>
          <em>
            <% if %w{年卡 月卡}.include?(sc.card_type) %>
              -
            <%else%>
              <%= p "card_type:#{sc.card_type.class}" %>
              <% if sc.card_type == "充值" %>
                <%= sc.amount%> 元 
              <% elsif %w{次卡 直接售卖}.include?(sc.card_type) %>
                <%= sc.amount %> 次 
              <% else %>
                <%= "" %> 次 
              <% end %>
            <%end%>
          </em>
        </div>
        <div>
          <span>有效期限:</span>
          <em><%= sc.invalidated_at.strftime("%Y年%m月%d日") %></em>
        </div>
      </div>
    <% end %>
  </div>
  <!-- 前台权限控制 flydragon -->
  <% if !current_user.is_receptionist? %>
    <h3>
      <span>统计信息</span>
    </h3>
    <div class="course-b clearfix">
      <div class="st-dein clearfix">
        <div>
          <span>累计上课次数:</span>
          <em><%= @student.check_ins.count %></em>
        </div>
        <div>
          <span>累计消费金额:</span>
          <em><%= @student.accumulated_amount %></em>
        </div>
      </div>
    </div>
  <% end %>
</div>
<script src="/assets/js/common.js"></script>
